package com.example.controlleradvice.globalExceptionHander;

import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import java.sql.SQLException;

/**
 * <pre>
 * 功能描述：全局异常处理
 * </pre>
 *
 * @author: 李明杰
 * @date: 2022/6/6 13:30
 */
@ControllerAdvice
@Slf4j
public class GlobalConfigExceptionHandler {
    @ExceptionHandler(ArithmeticException.class)
    public void customException(ArithmeticException e) {
        log.error("ArithmeticException handling completed!");
    }

    @ExceptionHandler(SQLException.class)
    public void sqlExceptionHandler(SQLException e) {
        log.error("SQLException handling completed!");
    }
}
